#!/bin/bash
#显示变量的个数
echo "the number of argument is $#"


#在大括号里面不能使用$符号,使用！替代
echo "the last argument is ${!#}"


#获取所有的参数
#$* 将所有参数看做一个字符串
echo  "Using the \$* : $*"

count=1

for arg in $*
do
    echo "\$* parameter #$count = $arg" 
    count=$[ $count + 1 ]
done

count=1
#$# 将所有参数看做多个对象
echo  "Using the \$@ : $@"
for arg in $@
do
    echo "\$@ parameter #$count = $arg" 
    count=$[ $count + 1 ]
done

# shift 将参数向左移动一次 最左边的值会丢失
count=1

while test -n "$1"
do
    echo "parameter #$count= $1"
    count=$[ $count + 1 ]
    echo "parameter shift to left"
    shift
done

